package com.ijustyce.market.ItemAndAdapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.ijustyce.market.R;

import java.util.List;

public class Comment_Adapter extends RecyclerView.Adapter<MyAdapter.ViewHolder> {

    private List<comment> Kind_List;
    static class ViewHolder extends RecyclerView.ViewHolder{
        ImageView Image;
        public ViewHolder(View view){
            super(view);
            Image=(ImageView)view.findViewById(R.id.dv);
           }
        }
        public Comment_Adapter(List<comment> kinds_list){Kind_List=kinds_list;}
        @NonNull
        @Override
        public MyAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
            View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_kind, parent, false);
            MyAdapter.ViewHolder holder = new MyAdapter.ViewHolder(view);
            return holder;

        }

        @Override
        public void onBindViewHolder(@NonNull MyAdapter.ViewHolder holder, int position) {
            comment kind=Kind_List.get(position);
            holder.Image.setImageResource(kind.getImageId());
        }

        @Override
        public int getItemCount() {
            return Kind_List.size();
        }
    }


